<extend name="_layout/main" />
<block name="head">
	<style>
		.bootbox-body img {
			max-width: 100%!important;
		}
	</style>

</block>
<block name="content">
	<div class="page-content">
		<div class="page-breadcrumbs">
			<ul class="breadcrumb">
				<li>
					<i class="fa fa-home"></i>
					<a href="{:U('dashboard/index')}">系统首页</a>
				</li>
				<li>
					<a href="{:U('article/announcement')}">公告管理</a>
				</li>
				<li class="active">公告列表</li>
			</ul>
		</div>
		
		<div class="page-body">
			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12">
					<div class="widget">
						<div class="widget-header bordered-left bordered-darkorange">
							<span class="widget-caption">搜索</span>
							<div class="widget-buttons">

								<a href="#" data-toggle="collapse">
									<i class="fa fa-minus"></i>
								</a>
								<a href="#" data-toggle="dispose">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="widget-body bordered-left bordered-warning">
							<form class="form-inline" role="form">
								<div class="form-group">
									<input type="text" class="form-control" name="title" placeholder="搜索公告" value="{$Think.request.title}">
								</div>

								<button type="submit" class="btn btn-default">搜索</button>
								
								 <a  href="{:U('announcement/add')}" class="btn btn-blue pull-right">
								 	<i class="fa fa-plus"></i>
                                           	添加公告
                                  </a>
							</form>
							
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12 col-md-12">
					<form action="{:U('announcement/sort')}" method="post">
					<table class="table table-bordered table-hover">
						<thead>
							<tr>
								<th class="text-center">排序</th>
								<th class="text-center">ID</th>
								<th class="text-center">标题</th>
								<th class="text-center">发布时间</th>
								<th class="text-center">操作</th>
							</tr>
						</thead>
						<volist name="result" id="val">
							<tr>
								<td class="text-center input-group-xs" style="width: 80px;"><input type="text" class="form-control text-center" min="0" max="9999" maxlength="4" value="{$val.sort}" name="sort[{$val['id']}]"></td>
								<td class="text-center">{$val.id}</td>
								<td>{$val.title}</td>
								<td class="text-center">{$val.add_time}</td>
								<td class="text-center">
									<a href="javascript:;" data-id="{$val.id}" class="btn btn-default btn-xs back views"><i class="fa  fa-eye"></i>查看</a>
									<a href="{:U('announcement/edit',['id'=>$val['id']])}" class="btn btn-default btn-xs"><i class="fa  fa-edit"></i>编辑</a>
									<a href="{:U('announcement/delete',['id'=>$val['id']])}" class="btn btn-danger btn-xs white" data-confirm="确定删除该文章?"><i class="fa fa-trash-o"></i>删除</a>

								</td>

							</tr>
						</volist>
						<tbody>
						</tbody>
					</table>
					<div class="row DTTTFooter">
						<div class="col-sm-6">
							<div class="dataTables_info" id="simpledatatable_info" role="status" aria-live="polite">
								<div class="buttons-preview">
									<button class="btn btn-default shiny" type="submit">排序</button>
								</div>
							</div>
						</div>
						<div class="col-sm-6">
							<div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
								{$page}
							</div>
						</div>
					</div>
					</form>
				</div>
			</div>

		</div>
	</div>
</block>

<block name="footer">

	<script type="text/javascript">
		var baseUrl = location.href;
		$(".views").on("click", function() {
			var id = $(this).data("id");
			$.get("{:U('announcement/detail')}", {
				id: id
			}, function(result) {
				var url = baseUrl + "?_s=" + result.message.source;
				var title = document.title;
				window.history.pushState({
					title: title,
					url: url
				}, title, url);
				bootbox.dialog({
					//title:"文章详情",
					message: result.message.content
				})
			}, "json");
		})
	</script>
</block>